import request from '@/utils/request';

/**
 * 新增款式
 */
export const addStyle = (data: any) => {
  return request({
    url: '/sj/productStyle',
    method: 'post',
    data: data
  });
};

/**
 * 获取类型列表
 */
export const getStyleList = () => {
  return request({
    url: '/sj/productComponentBasic/getAllComponent',
    method: 'get',
  });
};

/**
 * 获取款式列表
 */
export const getStyleListByType = (data: any) => {
  return request({
    url: '/sj/productStyle/list',
    method: 'post',
    data
  });
};

/**
 * 款式详情
 */
export const getStyleDetail = (id: any) => {
  return request({
    url: '/sj/productStyle/' + id,
    method: 'get',
  });
};

/**
 * 修改款式
 */
export const updateStyle = (data: any) => {
  return request({
    url: '/sj/productStyle',
    method: 'put',
    data: data
  });
};

/**
 * 获取配件属性
 */
export const getAccessoryAttr = (data: any) => {
  return request({
    url: '/sj/productStyle/getProductById',
    method: 'get',
    params: data
  });
};


/**
 * 保存配置信息
 */
export const saveConfig = (data: any) => {
  return request({
    url: '/sj/productStyle/saveSetting',
    method: 'post',
    data: data
  });
};

/**
 * 删除款式
 */
export const deleteStyle = (data: any) => {
  return request({
    url: '/sj/productStyle/remove',
    method: 'delete',
    params: data
  });
};